home *** CD-ROM | disk | FTP | other *** search
- /* ViewIt 2.03 Demonstration Program */
- /* ©FaceWare 1991-92. All Rights Reserved. */
-
- #include "string.h"
- #include "FaceStorLC.h"
- extern struct FaceRec fRec;
-
- short helpShown;
- struct {
- short myInteger;
- float myReal;
- char myString[100];
- long myFlags;
- } myRec;
- float theReal;
-
- pascal void fJumpIt(Ptr thePtr) = {0x2257,0x2051,0x4E90};
-
- pascal void OverProc(Ptr thePtr) {
- float delta;
- ControlHandle theArrow;
- if (fRec.cResID == 1000) { /* Arrow Controls */
- if (fRec.uCommand == 8) { /* mouse down message? */
- delta = 0.001 * (fRec.cMin - 2);
- theArrow = fRec.cControl;
- HiliteControl(theArrow,1);
- while (StillDown() == true) {
- myRec.myReal = myRec.myReal + delta;
- FaceIt(0L,SetVal,0L,0L,2L,2L);
- Delay(5,&fRec.uI4);
- }
- HiliteControl(theArrow,0);
- return;
- }
- }
- else { /* Editable Text Item */
- if (fRec.uCommand == 264) /* a key down message? */
- if (fRec.uParam[0] == 32) /* SPACE key pressed? */
- fRec.uParam[0] = 95; /* convert to UNDERLINE */
- }
- fJumpIt(thePtr);} /* pass message to driver */
-
- main()
- {
- myRec.myInteger = 0;
- myRec.myReal = 6.2;
- strcpy(myRec.myString,"Hello");
- myRec.myFlags = 10;
- theReal = 6.0;
-
- /* Initialize FaceIt */
- strcpy(fRec.uName, "vDemo.Rsrc");
- FaceIt(0L,DoInit,0L,0L,0L,0L);
-
- /* Show ViewIt On-Line Help (if available) */
- FaceIt(0L,HlpWnd,0L,0L,10L,10L);
-
- /* Open Modeless Window using FWND 1000 */
- FaceIt(0L,NewWnd,1000L,1L,0L,0L);
-
- for (;;) {
- FaceIt(0L,DoLoop,0L,0L,0L,0L);
- /* Standard "About" Menu Item Selection */
- if ((fRec.uMenuID == 101L) && (fRec.uMenuItem == 1L)) {
- strcpy(fRec.uString, "Demonstration of the use of ViewIt\rwindows in a FaceIt-based program.");
- FaceIt(0L,ShoStr,3L,12L,(1L + (409L * 65536L)),0L);
- }
- /* Hit in Modeless Window's "Open Modal" Button */
- else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 2L)) {
- FaceIt(0L,NewWnd,1001L,0L,0L,0L); /* Open Modal Window */
- for (;;) {
- FaceIt(0L,MdlWnd,1001L,0L,0L,0L); /* Process Modal Events */
- if (fRec.wcHit == -1L) /* Hit in Close Box */
- break;
- else if (fRec.wcHit == 1L) { /* Hit in "Open Nested" Button */
- FaceIt(0L,NewWnd,1002L,0L,0L,(long)&myRec); /* Open Nested Modal */
- FaceIt(0L,GetCtl,1002L,0L,2L,3L); /* Setup Override Examples */
- FaceIt(0L,OvrCtl,(long)fRec.cControl,(long)&OverProc,0L,0L);
- FaceIt(0L,GetCtl,1002L,0L,2L,6L);
- FaceIt(0L,OvrCtl,(long)fRec.cControl,(long)&OverProc,0L,0L);
- FaceIt(0L,GetCtl,1002L,0L,2L,7L);
- FaceIt(0L,OvrCtl,(long)fRec.cControl,(long)&OverProc,0L,0L);
- FaceIt(0L,SetVal,1002L,0L,0L,0L); /* Set Linked Values */
- helpShown = false;
- for (;;) {
- FaceIt(0L,MdlWnd,1002L,0L,0L,0L); /* Process Modal Events */
- if (fRec.wvHit == 1L) { /* Hit in View #1 */
- if (fRec.wcHit == 1L) /* Hit in "OK" Button */
- break;
- else if (fRec.wcHit == 2L) { /* Hit in "Show/Hide" */
- if (helpShown == true) {
- FaceIt(0L,ShoCtl,0L,0L,-3L,2L); /* Hide v3, Show v2 */
- helpShown = false;}
- else {
- FaceIt(0L,ShoCtl,0L,0L,-2L,3L); /* Hide v2, Show v3 */
- helpShown = true;}
- }
- }
- }
- FaceIt(0L,GetVal,1002L,0L,0L,0L); /* Get Linked Values */
- FaceIt(0L,EndWnd,1002L,0L,0L,0L); /* Close Nested Modal */
- }
- }
- FaceIt(0L,EndWnd,1001L,0L,0L,0L); /* Close Modal Window */
- }
- /* Hit in Modeless Window's "Why ViewIt?" Button */
- else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 3L)) {
- FaceIt(0L,NewWnd,1003L,0L,0L,(long)&theReal);
- FaceIt(0L,SetVal,1003L,0L,0L,0L);
- for (;;) {
- FaceIt(0L,MdlWnd,1003L,0L,0L,0L);
- if (fRec.wcHit == 1L) break;}
- FaceIt(0L,GetVal,1003L,0L,0L,0L);
- FaceIt(0L,EndWnd,1003L,0L,0L,0L);
- }
- }
- }